using System;
using System.Linq;
using Locator.Silverlight.Client.Models.StoresServiceReference;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace Locator.Silverlight.Client.Test
{
    public class MockStoreService : IStoresServiceAsync
    {
        public ObservableCollection<PersonalLocation> GetPersonalLocationsForCurrentUserResult { get; set; }

        public ObservableCollection<string> AllCitiesResult { get; set; }

        public ObservableCollection<Store> FindStoresByLatitudeAndLongitudeResult { get; set; }

        public ObservableCollection<Store> FindStoresByPersonalLocationResult { get; set; }

        public ObservableCollection<Store> FindStoresByPostalCodeResult { get; set; }

        public ObservableCollection<Store> FindStoresInCityResult { get; set; }

        public ObservableCollection<Store> GetStoresForCurrentUserResult { get; set; }

        public bool AddCalled { get; private set; }

        public bool DeleteCalled { get; private set; }

        public int RadiusSearched { get; private set; }

        public void GetPersonalLocationsForCurrentUserAsync()
        {
            if (this.GetPersonalLocationsForCurrentUserCompleted != null)
            {
                this.GetPersonalLocationsForCurrentUserCompleted(null, new GetPersonalLocationsForCurrentUserCompletedEventArgs(new object[] { this.GetPersonalLocationsForCurrentUserResult }, null, false, null));
            }
        }

        public event EventHandler<GetPersonalLocationsForCurrentUserCompletedEventArgs> GetPersonalLocationsForCurrentUserCompleted;

        public void DeleteStoreForCurrentUserAsync(int storeNumber)
        {
            if (this.DeleteStoreForCurrentUserCompleted != null)
            {
                this.DeleteStoreForCurrentUserCompleted(null, new AsyncCompletedEventArgs(null, false, null));
                this.DeleteCalled = true;
            }
        }

        public event EventHandler<AsyncCompletedEventArgs> DeleteStoreForCurrentUserCompleted;

        public void AddStoreForCurrentUserAsync(int storeNumber)
        {
            if (this.AddStoreForCurrentUserCompleted != null)
            {
                this.AddStoreForCurrentUserCompleted(null, new AsyncCompletedEventArgs(null, false, null));
                this.AddCalled = true;
            }
        }

        public event EventHandler<AsyncCompletedEventArgs> AddStoreForCurrentUserCompleted;

        public void AllCitiesAsync()
        {
            if (this.AllCitiesCompleted != null)
            {
                this.AllCitiesCompleted(null, new AllCitiesCompletedEventArgs(new object[] { this.AllCitiesResult }, null, false, null));
            }
        }

        public event EventHandler<AllCitiesCompletedEventArgs> AllCitiesCompleted;

        public void FindStoresByLatitudeAndLongitudeAsync(decimal latitude, decimal longitude, int radiusInKm)
        {
            if (this.FindStoresByLatitudeAndLongitudeCompleted != null)
            {
                this.FindStoresByLatitudeAndLongitudeCompleted(null, new FindStoresByLatitudeAndLongitudeCompletedEventArgs(new object[] { this.FindStoresByLatitudeAndLongitudeResult }, null, false, null));
                this.RadiusSearched = radiusInKm;
            }
        }

        public event EventHandler<FindStoresByLatitudeAndLongitudeCompletedEventArgs> FindStoresByLatitudeAndLongitudeCompleted;

        public void FindStoresByPersonalLocationAsync(int personalLocationId, int radiusInKm)
        {
            if (this.FindStoresByPersonalLocationCompleted != null)
            {
                this.FindStoresByPersonalLocationCompleted(null, new FindStoresByPersonalLocationCompletedEventArgs(new object[] { this.FindStoresByPersonalLocationResult }, null, false, null));
                this.RadiusSearched = radiusInKm;
            }
        }

        public event EventHandler<FindStoresByPersonalLocationCompletedEventArgs> FindStoresByPersonalLocationCompleted;

        public void FindStoresByPostalCodeAsync(string postalCode, int radiusInKm)
        {
            if (this.FindStoresByPostalCodeCompleted != null)
            {
                this.FindStoresByPostalCodeCompleted(null, new FindStoresByPostalCodeCompletedEventArgs(new object[] { this.FindStoresByPostalCodeResult }, null, false, null));
                this.RadiusSearched = radiusInKm;
            }
        }

        public event EventHandler<FindStoresByPostalCodeCompletedEventArgs> FindStoresByPostalCodeCompleted;

        public void FindStoresInCityAsync(string cityName)
        {
            if (this.FindStoresInCityCompleted != null)
            {
                this.FindStoresInCityCompleted(null, new FindStoresInCityCompletedEventArgs(new object[] { this.FindStoresInCityResult }, null, false, null));
            }
        }

        public event EventHandler<FindStoresInCityCompletedEventArgs> FindStoresInCityCompleted;

        public void GetStoresForCurrentUserAsync()
        {
            if (this.GetStoresForCurrentUserCompleted != null)
            {
                this.GetStoresForCurrentUserCompleted(null, new GetStoresForCurrentUserCompletedEventArgs(new object[] { this.GetStoresForCurrentUserResult }, null, false, null));
            }
        }

        public event EventHandler<GetStoresForCurrentUserCompletedEventArgs> GetStoresForCurrentUserCompleted;

        public IAsyncResult BeginGetPersonalLocationsForCurrentUser(AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public ObservableCollection<PersonalLocation> EndGetPersonalLocationsForCurrentUser(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginFindStoresByPostalCode(string postalCode, int radiusInKm, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public ObservableCollection<Store> EndFindStoresByPostalCode(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginFindStoresByLatitudeAndLongitude(decimal latitude, decimal longitude, int radiusInKm, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public ObservableCollection<Store> EndFindStoresByLatitudeAndLongitude(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginFindStoresByPersonalLocation(int personalLocationId, int radiusInKm, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public ObservableCollection<Store> EndFindStoresByPersonalLocation(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginGetStoresForCurrentUser(AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public ObservableCollection<Store> EndGetStoresForCurrentUser(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginFindStoresNotUsedByCurrentUser(AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public ObservableCollection<Store> EndFindStoresNotUsedByCurrentUser(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginAllCities(AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public ObservableCollection<string> EndAllCities(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginFindStoresInCity(string cityName, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public ObservableCollection<Store> EndFindStoresInCity(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginAddStoreForCurrentUser(int storeNumber, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public void EndAddStoreForCurrentUser(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginDeleteStoreForCurrentUser(int storeNumber, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public void EndDeleteStoreForCurrentUser(IAsyncResult result)
        {
            throw new NotImplementedException();
        }
    }
}
